package com.wanmait.movie.util;

import javax.servlet.http.HttpServletRequest;

public class SysContext {

    private static ThreadLocal<Integer> pageNumThreadLocal = new ThreadLocal<>() ;
    //请求的线程本地变量
    private static ThreadLocal<HttpServletRequest> requestThreadLocal = new ThreadLocal<>() ;
    //setter getter方法
    public static void setRequest(HttpServletRequest request) {
        requestThreadLocal.set(request) ;
    }
    public static HttpServletRequest getRequest() {
        return requestThreadLocal.get() ;
    }
    //setter
    public static void setPageNum(Integer pageNum) {
        pageNumThreadLocal.set(pageNum) ;
    }

    //getter
    public static Integer getPageNum() {
        return pageNumThreadLocal.get() ;
    }
    public static void clear() {
        requestThreadLocal.remove() ;
        pageNumThreadLocal.remove() ;
    }

}
